<?php

require '../conf.php';

class CDIndex extends FormWriter {

  protected $db = array(
    '.name' => 'FW_cdindex',
    '.user' => USER,
    '.pw'   => PW,
    'borrower' => array(
      'nickname' => array(
        'type'   => 'str',
        'maxlen' => 20
      ),
      'fullname' => array(
        'type'   => 'str',
        'maxlen' => 100,
        'size'   => 50
      ),
      '.key' => 'nickname'
    ),
    'media' => array(
      'id' => array(
        'type'    => 'int',
        'minval'  => 0,
        'autoinc' => TRUE
      ),
      'description' => array(
        'type'   => 'str',
        'null'   => FALSE,
        'maxlen' => 100,
        'size'   => 50
      ),
      'borrower' => 'borrower.nickname',
      '.key' => array(
        'id',
        array(
          'cols'  => 'borrower',
          'table' => 'borrower',
          'refs'  => 'nickname'
        )
      )
    )
  );
}

/*
  TODO:

  Add New Media
    Input:  id (if exists already error, if empty auto-increment), description*
    Output:  media $desc has number $id

  Delete Media
    First search, then you can delete
    Output:  "Destroy media no. $id ($desc)? You can reuse this id later" (ask for confirmation)

  Find Media:
    Input:  id* (if not exists error)
    Input:  description* (equals, starts with, contains; if not exists error)
    Input: borrower (equals, starts with, contains; nick and/or full name)

    Output:  id, description, borrower (nick and full name; table with paginator)

  Edit Media
    First search, then you can change description or borrower

  Browse Media (all or only search results):
    Input: order of the field (default: by id descendant)
    Output: id, description, borrower (nick and full name; table with paginator)
 */

# End of file
# vim: set ts=2 sw=2 et:
?>
